package com.atjava.nebula.frames.auth.service;

import java.util.List;

import com.atjava.nebula.core.dao.ibatis.BaseIBatisDao;
import com.atjava.nebula.core.service.impl.GenericServiceImpl;
import com.atjava.nebula.frames.auth.SysAuth;
import com.atjava.nebula.frames.auth.dao.AuthDao;
import com.atjava.nebula.frames.resources.SysResource;
import com.atjava.nebula.frames.role.SysRole;

public class AuthServiceImpl extends GenericServiceImpl<SysAuth,Short> implements AuthService{
	
	private BaseIBatisDao roleDao;
	
	private AuthDao authDao;
	
	public List<SysResource> getResourcesByRole(Short roleId) {
		return authDao.getResourcesByRole(roleId);
	}
	
	public List<SysResource> getResourcesByRoles(List<Short> roleIds) {
		return authDao.getResourcesByRoles(roleIds);
	}

	public List<SysRole> getAllRoles() {
		return roleDao.getAll(SysRole.class);
	}

	public List<SysRole> getRolesByUser(String userId) {
		return authDao.getRolesByUser(userId);
	}

	public void setRoleDao(BaseIBatisDao roleDao) {
		this.roleDao = roleDao;
	}

	public void setAuthDao(AuthDao authDao) {
		this.authDao = authDao;
	}

}
